<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/tableSel.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript">
		function dosubmit(){
		   $('#listForm').submit();
		};
		function goEdit(){
			location.href='<s:url value="/contract/Contract/edit"/>';
		};
		
		function goDelete(form){
			form = document.getElementById('listForm');
			var ids = getSelectionIds('a');
			if(ids.length<1){
				alert('Please select one at least.');
			}else{
			    if(confirm("are you sure to delete this contract!")){
				form.action=form.action.replace('list','delete');
				$('#ids').val(ids);
				form.submit();
				}
			}
		};
		function changedisplay(el){
			el.toggle("fast",function() {
				//$Container.getContainerProxy().resize();
			});
		};
		 $(function(){
		    $('#selCreateStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCreateEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCommitStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCommitEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selFinishStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selFinishEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selBeginStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selBeginEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selEndStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selEndEndTime').datepicker( {dateFormat :'yy-mm-dd'});
    	 	  if($.trim($('#result').text())!=''){
	               popupDiv('pop-div');
	          };
		 });
</script>
		<title><s:text name="system.title" />
		</title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="Contract/list" name="listForm" id="listForm"
						namespace="/contract">
						<input type="hidden" id="startIndex" name="startIndex" value="0" />
						<s:hidden name="ids" id="ids" />
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
									&nbsp;Name :
									<s:textfield id="selleadsName"  name="leadsName" cssClass="input2" size="8" />
									&nbsp;Tel:
									<s:textfield id="selleadsTel"  name="leadsTel" cssClass="input2" size="13" />
									&nbsp;Contract No:
									<s:textfield id="selcontractNo" name="contractNo" cssClass="input2" size="13" />
									<s:select id="selContractState"  name="contractState"  listKey="name()"
										    headerKey="" headerValue="--all--"
											list="@com.ef.constant.EContractState@values()"></s:select>
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										align="absmiddle" onclick="javascript:dosubmit();" />
									<img src="<s:url value="/img/right/btn-s2.gif"/>" border="0" style="cursor:pointer"
										align="absmiddle" onclick="javascript:changedisplay($('#div1'));"/> 
									<img src="<s:url value="/img/right/btn4.gif"/>" border="0"  style="cursor:pointer"
										align="absmiddle" onclick="javascript:reset2();" />
									&nbsp;
									<img onclick="javascript:goEdit();"
										src="<s:url value="/img/right/btn1.gif"/>" border="0"
										align="absmiddle" />
									<img onclick="goDelete(this.form);"
										src="<s:url value="/img/right/btn2.gif"/>" border="0"
										align="absmiddle" />
								</td>
							</tr>
						</table>
							<div id='div1' style="display: none;">
							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#E0F5FF">
								<tr>
									<td height="40">
										&nbsp;Create Time:
										<s:textfield  id="selCreateStartTime" name="selCreateStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selCreateEndTime" name="selCreateEndTime" cssClass="input2" size="13" /> 
								        &nbsp;Commit Time:
										<s:textfield  id="selCommitStartTime" name="selCommitStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selCommitEndTime" name="selCommitEndTime" cssClass="input2" size="13" /> 
							            &nbsp;Finish Time:
										<s:textfield  id="selFinishStartTime" name="selFinishStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selFinishEndTime" name="selFinishEndTime" cssClass="input2" size="13" /> 
									</td>
								</tr>
									<tr>
									<td height="40">
								        &nbsp;Begin Time:
										<s:textfield  id="selBeginStartTime" name="selBeginStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selBeginEndTime" name="selBeginEndTime" cssClass="input2" size="13" /> 
							            &nbsp;End Time:
										<s:textfield  id="selEndStartTime" name="selEndStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selEndEndTime" name="selEndEndTime" cssClass="input2" size="13" /> 
									</td>
								</tr>
 							</table>
						</div>
						<table width="100%" border="0" cellpadding="0" cellspacing="1"
							class="box2 activeTable">
							<tr>
								<td width="33" class="tablecolour1">
									<input type="checkbox" name="all" onclick="checkAll('a',this)" />
								</td>
								<td class="tablecolour1">
									Name
								</td>
								<td class="tablecolour1">
									Contract No
								</td>
								<td class="tablecolour1">
									Mobile
								</td>
								<td class="tablecolour1">
									CC
								</td>
								<td class="tablecolour1">
									Price
								</td>
								<td class="tablecolour1">
									Level
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Begin
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									End
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Status
								</td>
								<td class="tablecolour1">
									Function
								</td>
							</tr>
							<s:iterator value="listResult.items" status="status">
								<tr>
									<td class="tablecolour2">
										<input type="checkbox" name="a"
											value="<s:property value="id" />" />
									</td>
									<td class="tablecolour2">
										<s:property value="leads.name" />
									</td>
									<td class="tablecolour2">
										<s:property value="contractNo" />
									</td>
									<td class="tablecolour2">
										<s:property value="leads.mobileTelephone" />
									</td>
									<td class="tablecolour2">
										<s:property value="leads.cc.name" />
									</td>
									<td class="tablecolour2">
										<s:property value="price" />
									</td>
									<td class="tablecolour2">
										<s:property value="beginLevel.name" />
									</td>
									<td class="tablecolour2">
										<s:date name="startTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:date name="endTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:property value="contractStateMsg" />
									</td>
									<td class="tablecolour2">
									   <s:if test="contractStateMsg=='NEW'">
										<a
											href='<s:url value="/contract/Contract/edit?id="/><s:property value="id"/>'>Edit</a>
									   </s:if>
										<a
											href='<s:url value="/contract/Contract/view?id="/><s:property value="id"/>'>View</a>
									</td>
								</tr>
							</s:iterator>
						</table>
						<s:include value="/common/page.jsp"></s:include>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
		<div id='pop-div' style="width: 300px;" class="pop-box">
			<s:include value="/common/confirm.jsp"></s:include>
		</div>
	</body>
</html>